anatomy of grid functions

overview
A grid function defines, controls, and supports the grid type with the same name.   For instance, grid function XuiLabel() defines, controls, and supports all grids of XuiLabel grid type.

A grid function creates, operates, destroys every grid of its grid type.  To send a message to a grid means to call its grid function.  The way a grid function responds to the messages it receives determines the character of all grids of its grid type.

grid functions and callback functions
When you design a window interactively with GuiDesigner, then select Window ToFunction, you create a new grid type and add a corresponding grid function and callback function to your program.

As created by GuiDesigner, the grid function defines and handles the visual aspects of your new grid type and sends callback messages to your callback function. When your callback function receives callback messages it executes whatever code you put there for the occasion, which gives the grids their functionality and character.

merged grid functions
When you design a window to be a custom application window, it's more convenient to separate the visual and functional aspects into the grid function and callback function respectively.

But you don't have to.  You can put the functional aspects directly in the grid function, and do away with the callback function completely.  And if you want to create a new generic grid type you can distribute and/or add to the toolkit, you'll have to merge the functional part into the grid function eventually, or just put it there right from the start.

If you decide to add your code to the grid function, you'll need to understand grid functions in more detail than if you don't.

The rest of this section explain grid functions by discussing a standard grid function already in the toolkit, XuiDialog2B.

The code for XuiDialog2B is presented first, followed by a detailed line by line description.  The numbers on the left of each line are added to facilitate discussion - they are not line numbers!